﻿using System;
using System.Collections.Generic;
using System.Text;

namespace HL7v_2x
{
    public class HL7Fields
    {
        public HL7FieldName FieldName;
        public byte[] FieldValue;
        public HL7TypeData TypeDataField;
        public char chOPT;         //O    R
        public HL7SubFields SubField;

        public HL7Fields(HL7FieldName fieldNameParam,byte[] byFieldValueReceived)       //constructor
        {

            try
            {

                this.FieldName = fieldNameParam;

                switch (fieldNameParam)
                {
                    ///MSH
                    case HL7FieldName.FieldSeparator_MSH:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.EncodingCharacters_MSH:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SendingApplication_MSH:
                        FieldValue = new byte[227 + 1];
                        TypeDataField = HL7TypeData.TypeHD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SendingFacility_MSH:
                        FieldValue = new byte[227 + 1];
                        TypeDataField = HL7TypeData.TypeHD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ReceivingFacility_MSH:
                        FieldValue = new byte[227 + 1];
                        TypeDataField = HL7TypeData.TypeHD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ReceivingApplication_MSH:
                        FieldValue = new byte[227 + 1];
                        TypeDataField = HL7TypeData.TypeHD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DateTimeofMessage_MSH:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.Security_MSH:
                        FieldValue = new byte[40 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.MessageType_MSH:
                        FieldValue = new byte[15 + 1];
                        TypeDataField = HL7TypeData.TypeMSG;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.MessageControlID_MSH:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.ProcessingID_MSH:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypePT;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.VersionID_MSH:
                        FieldValue = new byte[60 + 1];
                        TypeDataField = HL7TypeData.TypeVID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SequenceNumber_MSH:
                        FieldValue = new byte[15 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ContinuationPointer_MSH:
                        FieldValue = new byte[180 + 1];
                        chOPT = 'O';
                        TypeDataField = HL7TypeData.TypeST;
                        break;
                    case HL7FieldName.AcceptAknowledgmentType_MSH:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ApplicationAknowledgmentType_MSH:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CountryCode_MSH:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CharacterSet_MSH:
                        FieldValue = new byte[16 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PrincipalLanguageofMessage_MSH:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AlternateCharacterSetHandlingScheme_MSH:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.MessageProfileIdentifier_MSH:
                        FieldValue = new byte[427 + 1];
                        TypeDataField = HL7TypeData.TypeEI;
                        chOPT = 'O';
                        break;

                    ///EVN///////////*************************************
                    case HL7FieldName.TypecodeEvent_EVN:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.RecordedDateTime_EVN:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.DateTimePlannedEvent_EVN:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.EventReasonCode_EVN:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.OperatorID_EVN:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.EventOcurred_EVN:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.EventFacility_EVN:
                        FieldValue = new byte[241 + 1];
                        TypeDataField = HL7TypeData.TypeHD;
                        chOPT = 'O';
                        break;
                    ///PID///////////**************************************
                    case HL7FieldName.SetId_PID:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeSI;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Patient_id_PID:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.PatientIdentifierList_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.AlternatePatientID_PID:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.PatientName_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXPN;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.MotherMaidenName_PID_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXPN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DateTimeofBirth_PID_NK1:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdministrativeSex_PID_NK1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientAlias_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXPN;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.Race_PID_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientAddress_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXAD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CountyCode_PID:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.PhoneNumberHouse_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXTN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PhoneNumberBusiness_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXTN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PrimaryLanguage_PID_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.MaritalStatus_PID_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Religion_PID_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientAccountNumber_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SSNNumberPatient_PID:
                        FieldValue = new byte[16 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.DriverLicenseNumberPatient_PID:
                        FieldValue = new byte[25 + 1];
                        TypeDataField = HL7TypeData.TypeDLN;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.MotherIdentifier_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.EthnicGroup_PID_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BirthPlace_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.MultipleBirthIndicator_PID:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BirthOrder_PID:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Citizenship_PID_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VeteransMilitaryStatus_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Nationality_PID_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.PatientDeathDateandTime_PID:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientDeathIndicator_PID:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.IdentityUnknownIndicator_PID:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.IdentityReliabilityCode_PID:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.LastUpdateDateTime_PID:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.LastUpdateFacility_PID:
                        FieldValue = new byte[40 + 1];
                        TypeDataField = HL7TypeData.TypeHD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SpeciesCode_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.BreedCode_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.Strain_PID:
                        FieldValue = new byte[80 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ProductionClassCode_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    ///PV1//////**************************************
                    case HL7FieldName.SetId_PV1:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeSI;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientClass_PV1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.AssignedPatientLocation_PV1:
                        FieldValue = new byte[80 + 1];
                        TypeDataField = HL7TypeData.TypePL;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdmisionType_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PreadmitNumber_PV1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PriodPatientLocation_PV1:
                        FieldValue = new byte[80 + 1];
                        TypeDataField = HL7TypeData.TypePL;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AttendingDoctor_PV1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ReferingDoctor_PV1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ConsultingDoctor_PV1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.HospitalService_PV1:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TemporaryLocation_PV1:
                        FieldValue = new byte[80 + 1];
                        TypeDataField = HL7TypeData.TypePL;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PreadmitTestIndicator_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ReAdmissionIndicator_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdmitSource_PV1:
                        FieldValue = new byte[6 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AmbulatoryStatus_PV1_NK1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VIPIndicator_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdmittingDoctor_PV1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientType_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VisitNumber_PV1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.FinancialClass_PV1:
                        FieldValue = new byte[50 + 1];
                        TypeDataField = HL7TypeData.TypeFC;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ChargePriceIndicator_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CourtesyCode_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CreditRating_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ContractCode_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ContractEffectiveDate_PV1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ContractAmount_PV1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ContractPeriod_PV1:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InterestCode_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TransfertoBadDebtCode_PV1:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TransfertoBadDebtDate_PV1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BadDebtAgencyCode_PV1:
                        FieldValue = new byte[10 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BadDebtTransferAmount_PV1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BadDebtRecoveryAmount_PV1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DeleteAccountIndicator_PV1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DeleteAccountDate_PV1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DischargeDisposition_PV1:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DischargedtoLocation_PV1:
                        FieldValue = new byte[47 + 1];
                        TypeDataField = HL7TypeData.TypeDLD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DietType_PV1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ServicingFacility_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BedStatus_PV1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.AccountStatus_PV1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PendingLocation_PV1:
                        FieldValue = new byte[80 + 1];
                        TypeDataField = HL7TypeData.TypePL;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PriorTemporaryLocation_PV1:
                        FieldValue = new byte[80 + 1];
                        TypeDataField = HL7TypeData.TypePL;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdmitDate_Time_PV1:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DischargeDateTime_PV1:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CurrentPatientBalance_PV1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TotalCharges_PV1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TotalAdjustments_PV1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TotalPayments_PV1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AlternateVisitID_PV1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VisitIndicator_PV1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.OtherHealthcareProvider_PV1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'B';
                        break;
                    ///IN1//////**************************************
                    case HL7FieldName.SetID_IN1:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeSI;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.Insurance_PlanID_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.InsuranceCompanyID_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.InsuranceCompanyName_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXON;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuranceCompanyAddress_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXAD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuranceCoContactPerson_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXPN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuranceCoPhoneNumber_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXTN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.GroupNumber_IN1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.GroupName_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXON;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuredGroupEmpID_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuredGroupEmpName_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXON;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PlanEffectiveDate_IN1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PlanExpirationDate_IN1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AuthorizationInformation_IN1:
                        FieldValue = new byte[239 + 1];
                        TypeDataField = HL7TypeData.TypeAUI;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PlanType_IN1:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NameofInsured_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXPN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuredRelationshiptoPatient:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuredDateofbirth:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuredAddress:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXAD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AssigmentsofBenefits:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CoorinationofBenefits:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CoordinationofbenefitsPriority:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NoticeofAdmissionFlag:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NoticeofAdmissionDate:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ReportofeligibilityFlag_IN1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ReportofeligibilityDate_IN1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ReleaseInformationCode_IN1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PreadmitCert_IN1:
                        FieldValue = new byte[15 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VerificationDateTime_IN1:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VerificationBy_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TypeofAgreementCode_IN1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BillingStatus_IN1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.LifetimeReserveDays_IN1:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DelayBeforeLRDays_IN1:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CompanyPlanCode_IN1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PolicyNumber_IN1:
                        FieldValue = new byte[15 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PolicyDeductible_IN1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeCP;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PolicyLimitAmount_IN1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeCP;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.PolicyLimitDays_IN1:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RoomRateSemiPrivate_IN1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeCP;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.RoomRatePrivate_IN1:
                        FieldValue = new byte[12 + 1];
                        TypeDataField = HL7TypeData.TypeCP;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.InsuredEmploymentStatus_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuredAdministrativeSex_IN1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuredEmployerAddress_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXAD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VerificationStatus_IN1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PriorInsurancePlanID_IN1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CoverageType_IN1:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Handicap_IN1_NK1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuredIDNumber_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SignatureCode_IN1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SignatureCodeDate_IN1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.InsuredBirthPlace_IN1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VIPIndicator_IN1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    ///PV2/////////*****************************************************************
                    case HL7FieldName.PriorPendingLocation_PV2:
                        FieldValue = new byte[80 + 1];
                        TypeDataField = HL7TypeData.TypePL;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.AccommodationCode_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdmitReason_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TransferReason_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientValuables_PV2:
                        FieldValue = new byte[25 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientValuablesLocation_PV2:
                        FieldValue = new byte[25 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VisitUserCode_PV2:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ExpectedAdmitDateTime_PV2:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ExpectedDischargeDateTime_PV2:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.EstimatedLengthofInpatientStay_PV2:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ActualLengthofInpatientStay_PV2:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VisitDescription_PV2:
                        FieldValue = new byte[50 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ReferralSourceCode_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PreviousServiceDate_PV2:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.EmploymentIllnessRelatedIndicator_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PurgeStatusCode_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PurgeStatusDate_PV2:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SpecialProgramCode_PV2:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RetentionIndicator_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ExpectedNumberofInsurancePlans_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VisitPublicityCode_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VisitProtectionIndicator_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ClinicOrganizationName_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXON;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientStatusCode_PV2:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.VisitPriorityCode_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PreviousTreatmentDate_PV2:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ExpectedDischargeDisposition_PV2:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SignatureonFileDate_PV2:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.FirstSimilarIllnessDate_PV2:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientChargeAdjustmentCode_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RecurringServiceCode_PV2:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BillingMediaCode_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ExpectedSurgeryDateandTime_PV2:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.MilitaryPartnershipCode_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.MilitaryNonAvailabilityCode_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NewbornBabyIndicator_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BabyDetainedIndicator_PV2:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ModeofArrivalCode_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RecreationalDrugUseCode_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdmissionLevelofCareCode_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PrecautionCode_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientConditionCode_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.LivingWillCode_PV2:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.OrganDonorCode_PV2:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdvanceDirectiveCode_PV2:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PatientStatusEffectiveDate_PV2:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ExpectedLOAReturnDateTime_PV2:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    ///NK1 ---- NEXT OF KIN///////////*************************************
                    case HL7FieldName.SetID_NK1:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeSI;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.Name_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXPN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Relationship_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Address_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXAD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PhoneNumber_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXTN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.BusinessPhoneNumber_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXTN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ContactRole_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.StartDate_NK1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.EndDate_NK1:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NextofKinAssociatedPartiesJobTitle_NK1:
                        FieldValue = new byte[60 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NextofKinAssociatedPartiesJobCodeClass_NK1:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeJCC;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NextofKinAssociatedPartiesEmployeeNumber_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.OrganizationName_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXON;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.MaritalStatus_PID:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXON;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdministrativeSex_NK1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                 
                    case HL7FieldName.DateTimeofBirth_NK1:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                      */
                    case HL7FieldName.LivingDependency_NK1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.AmbulatoryStatus_NK1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Citizenship_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    
                    case HL7FieldName.PrimaryLanguage_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                     * */
                    case HL7FieldName.LivingArrangement_NK1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PublicityCode_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ProtectionIndicator_NK1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.StudentIndicator_NK1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.Religion_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                     case HL7FieldName.MotherMaidenName_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXPN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Nationality_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break; 
                    
                    case HL7FieldName.EthnicGroup_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                        */
                    case HL7FieldName.ContactReason_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ContactPersonName_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXPN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ContactPersonTelephoneNumber_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXTN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ContactPersonAddress_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXAD;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NextofKinAssociatedPartyIdentifiers_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCX;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.JobStatus_NK1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.Race_NK1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Handicap_NK1:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;*/
                    case HL7FieldName.ContactPersonSocialSecurityNumber_NK1:
                        FieldValue = new byte[16 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    //////////OBR /////////////**************************************************

                    case HL7FieldName.SetID_OBR:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeSI;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PlacerOrderNumber_OBR:
                        FieldValue = new byte[22 + 1];
                        TypeDataField = HL7TypeData.TypeEI;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.FillerOrderNumber_OBR:
                        FieldValue = new byte[22 + 1];
                        TypeDataField = HL7TypeData.TypeEI;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.UniversalServiceIdentifier_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.Priority_OBR:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.RequestedDateTime_OBR:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'B';
                        break;
                    case HL7FieldName.ObservationDateTime_OBR:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.ObservationEndDateTime_OBR:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CollectionVolume_OBR:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeCQ;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SpecimenActionCode_OBR:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DangerCode_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RelevantClinicalInformation_OBR:
                        FieldValue = new byte[300 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SpecimenReceivedDateTime_OBR:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.SpecimenSource_OBR:
                        FieldValue = new byte[300 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.OrderingProvider_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.OrderCallbackPhoneNumber_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXTN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PlacerField1_OBR:
                        FieldValue = new byte[60 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PlacerField2_OBR:
                        FieldValue = new byte[60 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.FillerField1m_OBR:
                        FieldValue = new byte[60 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.FillerField2m_OBR:
                        FieldValue = new byte[60 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ResultsRptStatusChngDateTimem_OBR:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.ChargetoPractice_OBR:
                        FieldValue = new byte[40 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.DiagnosticServSectID_OBR:
                        FieldValue = new byte[10 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.ResultStatus_OBR:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.ParentResult_OBR:
                        FieldValue = new byte[400 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.QuantityTiming_ORC_OBR_RXE_RXG:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeTQ;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ResultCopiesTo_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Parent_OBR:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TransportationMode_OBR:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ReasonforStudy_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PrincipalResultInterpreter_OBR:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AssistantResultInterpreter_OBR:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Technician_OBR:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Transcriptionist_OBR:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ScheduledDateTime_OBR:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NumberofSampleContainers_OBR:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TransportLogisticsofCollectedSample_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CollectorsComment_OBR:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TransportArrangementResponsibility_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TransportArranged_OBR:
                        FieldValue = new byte[30 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.EscortRequired_OBR:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PlannedPatientTransportComment_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ProcedureCode_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ProcedureCodeModifier_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PlacerSupplementalServiceInformation_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.FillerSupplementalServiceInformation_OBR:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    //// RQD **********************************************************************************////
                    case HL7FieldName.RequisitionLineNumber_RQD:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeSI;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ItemCodeInternal_RQD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.ItemCodeExternal_RQD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.HospitalItemCode_RQD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.RequisitionQuantity_RQD:
                        FieldValue = new byte[6 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RequisitionUnitofMeasure_RQD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DeptCostCenter_RQD:
                        FieldValue = new byte[30 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ItemNaturalAccountCode_RQD:
                        FieldValue = new byte[30 + 1];
                        TypeDataField = HL7TypeData.TypeIS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DeliverToID_RQD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DateNeeded_RQD:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeDT;
                        chOPT = 'O';
                        break;
                    //////////RQ1/////////******************************************
                    case HL7FieldName.AnticipatedPrice_RQ1:
                        FieldValue = new byte[10 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ManufacturerIdentifier_RQ1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.ManufacturerCatalog_RQ1:
                        FieldValue = new byte[16 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.VendorID_RQ1:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.VendorCatalog_RQ1:
                        FieldValue = new byte[16 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.Taxable_RQ1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SubstituteAllowed_RQ1:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    ///////RXO  PHARMACY TRATEMENT ORDER *******************************
                    case HL7FieldName.RequestedGiveCode_RXO:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.RequestedGiveAmountMinimum_RXO:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.RequestedGiveAmountMaximum_RXO:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RequestedGiveUnits_RXO:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.RequestedDosageForm_RXO:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.ProvidersPharmacyTreatmentInstructions_RXO:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ProvidersAdministrationInstructions_RXO_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DeliverToLocation_RXO_RXE:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AllowSubstitutions_RXO:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RequestedDispenseCode_RXO:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RequestedDispenseAmount_RXO:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RequestedDispenseUnits_RXO:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.NumberOfRefills_RXO_RXE:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.OrderingProvidersDEANumber_RXO_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.PharmacistTreatmentSuppliersVerifierID_RXO_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.NeedsHumanReview_RXO_RXE_RXG_RXD:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RequestedGivePerTimeUnit_RXO:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.RequestedGiveStrength_RXO:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RequestedGiveStrengthUnits_RXO:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Indication_RXO_RXD_RXG_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RequestedGiveRateAmount_RXO:
                        FieldValue = new byte[6 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.RequestedGiveRateUnits_RXO:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TotalDailyDose_RXO_RXE_RXD:
                        FieldValue = new byte[100 + 1];
                        TypeDataField = HL7TypeData.TypeCQ;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SupplementaryCode_RXO_RXC_RXD_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'C';
                        break;
                    //////RXC  - Pharmacy Tratement component order *************************************
                    case HL7FieldName.RXComponentType_RXC:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.ComponentCode_RXC:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.ComponentAmount_RXC:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.ComponentUnits_RXC:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.ComponentStrength_RXC:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ComponentStrengthUnits_RXC:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.SupplementaryCode_RXO_RXC_RXD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;*/

                    //////RXE -  Pharmacy Tratement Encoded Order ////********************************************************************////////////////////

                    /*case HL7FieldName.QuantityTiming_ORC_OBR_RXE_RXG:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeTQ;
                        chOPT = 'R';
                        break;
                     */
                    case HL7FieldName.GiveCode_RXE_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.GiveAmountMinimum_RXE_RXG:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.GiveAmountMaximum_RXE_RXG:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.GiveUnits_RXE_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.GiveDosageForm_RXE_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    /* case HL7FieldName.ProvidersAdministrationInstructions_RXO_RXE:
                         FieldValue = new byte[250 + 1];
                         TypeDataField = HL7TypeData.TypeCE;
                         chOPT = 'O';
                         break;
                
                     case HL7FieldName.DeliverToLocation_RXO_RXE:
                         FieldValue = new byte[200 + 1];
                         TypeDataField = HL7TypeData.TypeCM;
                         chOPT = 'C';
                         break;
                         */
                    case HL7FieldName.SubstitutionStatus_RXD_RXE_RXG:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DispenseAmount_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.DispenseUnits_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    /*case HL7FieldName.NumberofRefills_RXO_RXE:
                        FieldValue = new byte[3 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                     * */
                    /*case HL7FieldName.OrderingProvidersDEANumber_RXO_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'C';
                        break;
                        */
                    /* case HL7FieldName.PharmacistTreatmentSuppliersVerifierID_RXE:
                         FieldValue = new byte[250 + 1];
                         TypeDataField = HL7TypeData.TypeXCN;
                         chOPT = 'O';
                         break;
                     */
                    case HL7FieldName.PrescriptionNumber_RXD_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.NumberofRefillsRemaining_RXD_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.NumberofRefillsDosesDispensed_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.DTofMostRecentRefillorDoseDispensed_RXE:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'C';
                        break;
                    /*case HL7FieldName.TotalDailyDose_RXO_RXE_RXD:
                        FieldValue = new byte[10 + 1];
                        TypeDataField = HL7TypeData.TypeCQ;
                        chOPT = 'C';
                        break;                    
                    case HL7FieldName.NeedsHumanReview_RXE:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                     */
                    case HL7FieldName.PharmacyTreatmentSupplierSpecialDispensingInstructions_RXD_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.GivePerTimeUnit_RXG_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.GiveRateAmount_RXG_RXE:
                        FieldValue = new byte[6 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.GiveRateUnits_RXG_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.GiveStrength_RXG_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.GiveStrengthUnits_RXG_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.GiveIndication_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DispensePackageSize_RXD_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DispensePackageSizeUnit_RXD_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DispensePackageMethod_RXD_RXE:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.SupplementaryCode_RXO_RXC_RXD_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;*/
                    //////RXD -  Pharmacy Tratement Dispense ////********************************************************************////////////////////
                    case HL7FieldName.DispenseSubIDCounter_RXG_RXD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DispenseGiveCode_RXD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.DateTimeDispensed_RXD:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.ActualDispenseAmount_RXD:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.ActualDispenseUnits_RXD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.ActualDosageForm_RXD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.PrescriptionNumber_RXE_RXD:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.NumberofRefillsRemaining_RXD_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                     */
                    case HL7FieldName.DispenseNotes_RXD:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DispensingProvider_RXD:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.SubstitutionStatus_RXD_RXE_RXG:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.TotalDailyDose_RXO_RXE_RXD:
                        FieldValue = new byte[10 + 1];
                        TypeDataField = HL7TypeData.TypeCQ;
                        chOPT = 'O';
                        break;
                     */
                    case HL7FieldName.DispensetoLocation_RXD_RXG:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'C';
                        break;
                    /*case HL7FieldName.NeedsHumanReview_RXO_RXE_RXG_RXD:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PharmacyTreatmentSupplierSpecialDispensingInstructions_RXD_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                     */
                    case HL7FieldName.ActualStrength_RXD:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SubstanceLotNumber_RXD_RXG_RXA:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SubstanceExpirationDate_RXD_RXG_RXA:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SubstanceManufacturerName_RXD_RXG_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.Indication_RXO_RXD_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DispensePackageSize_RXD_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                     * 
                    case HL7FieldName.DispensePackageSizeUnit_RXD_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.DispensePackageMethod_RXD_RXE:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    
                    case HL7FieldName.SupplementaryCode_RXO_RXC_RXD_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                     * */
                    case HL7FieldName.InitiatingLocation_RXD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.PackagingAssemblyLocation_RXD:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;

                    ////RXG Pharmacy Tratement Give //////////*****************************************************************************************////////////////////
                    case HL7FieldName.GiveSubIDCounter_RXG_RXA:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.DispenseSubIDCounter_RXG_RXD:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.QuantityTiming_ORC_OBR_RXE_RXG:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeTQ;
                        chOPT = 'R';
                        break;                
                    case HL7FieldName.GiveCode_RXE_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;                 
                    case HL7FieldName.GiveAmountMinimum_RXE_RXG:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.GiveAmountMaximum_RXE_RXG:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;                
                    case HL7FieldName.GiveUnits_RXE_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;
                     case HL7FieldName.GiveDosageForm_RXE_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                     */
                    case HL7FieldName.AdministrationNotes_RXG_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.SubstitutionStatus_RXD_RXE_RXG:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;                 
                    case HL7FieldName.DispensetoLocation_RXD_RXG:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'O';
                        break;                 
                    case HL7FieldName.NeedsHumanReview_RXO_RXE_RXG_RXD:
                        FieldValue = new byte[1 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                     */
                    case HL7FieldName.PharmacyTreatmentSupplierSpecialAdministrationInstructions_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    /*
                    case HL7FieldName.GivePerTimeUnit_RXG_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'C';
                        break;                 
                    case HL7FieldName.GiveRateAmount_RXG_RXE:
                        FieldValue = new byte[6 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;                 
                    case HL7FieldName.GiveRateUnits_RXG_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;                 
                    case HL7FieldName.GiveStrength_RXG_RXE:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.GiveStrengthUnits_RXG_RXE:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;                
                    case HL7FieldName.SubstanceLotNumber_RXD_RXG:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SubstanceExpirationDate_RXD_RXG:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SubstanceManufacturerName_RXD_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Indication_RXO_RXD_RXG:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    */
                    /// RXA - Pharmacy Tratement Administration////////****************************************************************************//////////////////
                    /*case HL7FieldName.GiveSubIDCounter_RXG_RXA:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'R';
                        break;
                     */
                    case HL7FieldName.AdministrationSubIDCounter_RXA:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.DateTimeStartofAdministration_RXA:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.DateTimeEndofAdministration_RXA:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.AdministeredCode_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.AdministeredAmount_RXA:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'R';
                        break;
                    case HL7FieldName.AdministeredUnits_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.AdministeredDosageForm_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.AdministrationNotes_RXG_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                        */
                    case HL7FieldName.AdministeringProvider_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeXCN;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdministeredatLocation_RXA:
                        FieldValue = new byte[200 + 1];
                        TypeDataField = HL7TypeData.TypeCM;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.AdministeredPerTimeUnit_RXA:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'C';
                        break;
                    case HL7FieldName.AdministeredStrength_RXA:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeNM;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.AdministeredStrengthUnits_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.SubstanceLotNumber_RXD_RXG_RXA:
                        FieldValue = new byte[20 + 1];
                        TypeDataField = HL7TypeData.TypeST;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SubstanceExpirationDate_RXD_RXG_RXA:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SubstanceManufacturerName_RXD_RXG_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                     */
                    case HL7FieldName.SubstanceTreatmentRefusalReason_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                    /*case HL7FieldName.Indication_RXO_RXD_RXG_RXA:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;
                     */
                    case HL7FieldName.CompletionStatus_RXA:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.ActionCodeRXA_RXA:
                        FieldValue = new byte[2 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SystemEntryDateTime_RXA:
                        FieldValue = new byte[26 + 1];
                        TypeDataField = HL7TypeData.TypeTS;
                        chOPT = 'O';
                        break;
                    ///NTE /////////////////////////////////////////////////////////////////////////////////////
                    case HL7FieldName.SetID_NTE:
                        FieldValue = new byte[4 + 1];
                        TypeDataField = HL7TypeData.TypeSI;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.SourceOfComment:
                        FieldValue = new byte[8 + 1];
                        TypeDataField = HL7TypeData.TypeID;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.Comment:
                        FieldValue = new byte[65536 + 1];
                        TypeDataField = HL7TypeData.TypeFT;
                        chOPT = 'O';
                        break;
                    case HL7FieldName.CommentType:
                        FieldValue = new byte[250 + 1];
                        TypeDataField = HL7TypeData.TypeCE;
                        chOPT = 'O';
                        break;

                    default:
                        throw new NotImplementedException("No existe el nombre del campo " + fieldNameParam.ToString());

                }

                if (byFieldValueReceived != null)
                {
                    FieldValue = byFieldValueReceived;

                    SubField = new HL7SubFields(FieldValue);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("EXCEPCION AL CREAR FIELDS - Ex: " + ex.Message);
            }
        }
    }
}
